#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Farmer Li, 公众号: 很酷的程序员/RealCoolEngineer
# @Date: 2021-06-01
# @Question: https://www.zhihu.com/question/462545171

from pathlib import Path

import click

CONTACT_STORE_FILE = './.contacts.json'


def merge_file_to(file_1: Path, file_2: Path, dst_file: Path):
    with file_1.open('r') as f1, file_2.open('r') as f2:
        with dst_file.open('w+') as fout:
            for line in f1:
                fout.write(line)
            for line in f2:
                fout.write(line)


@click.command()
@click.argument('src-file1')
@click.argument('src-file2')
@click.argument('dst-file')
def main(src_file1, src_file2, dst_file):
    merge_file_to(Path(src_file1), Path(src_file2), Path(dst_file))


if __name__ == '__main__':
    main()
